/******************************************
 *Author:杨飙
 *Function:禁手判断
 *Created Date:2013.05.17
 *Last Modified:2013.05.28
 ******************************************/

#include "forbidden.h"
#include "data.h"
#include <stdio.h>
#include <stdlib.h>
int ishuosan1(int x,int y)   /*水平判断是否有活三*/
{
      int j,k,n1,n2;//j,k是循环变量，n1是向左的黑子数，n2是向右的黑子数
       n1=0;
       n2=0;
       /*水平判断是否有活三*/
       int x1,x2,y1,y2;//x1，y1是向左的第一个不是黑子点的坐标，x2,y2是向右的第一个不是黑子点的坐标
        /*水平向左数*/
        for(j=x,k=y;j>=0;j--)
        {
            if(ChessBoard[j][k]==1)//当该点为黑子时
            {
                   n1++;
                   x1=-1;y1=k;//如果到边缘仍为黑子，则x1+1=0,所以令x1=-1；
            }
            else//当不是黑子时
            {
                x1=j;y1=k;//记下此点的坐标
                break;
            }
        }
        /*水平向右数*/
        for(j=x,k=y;j<=14;j++)
        {
            if(ChessBoard[j][k]==1)//当该点为黑子时
            {
                 n2++;
                 x2=15;y2=k;//如果到边缘仍为黑子，则x2-1=14,所以令x2=15；
            }
            else//当不是黑子时
            {
                x2=j;y2=k;//记下此点的坐标
                break;
            }
        }
        if(n1+n2-1==3)//如果是连着的三
        {
            if(x1!=-1&&x2!=15)// 边缘的黑子不是位于棋盘边缘
            {
                 if(ChessBoard[x1][y1]==0&&ChessBoard[x2][y2]==0)// 边缘黑子的边缘没有子
                {
                   if(x1==0&&ChessBoard[x2+1][y2]==0) return(1);// 左边边缘黑子的横坐标是1，那么右边边缘黑子向右的第2个位置也没有子，就是活三
                   else if(x2==14&&ChessBoard[x1-1][y1]==0) return(1);//  右边边缘黑子的横坐标是13，那么右边边缘黑子向左的第2个位置也没有子，就是活三
                   else if(ChessBoard[x1-1][y1]!=1&&ChessBoard[x2+1][y2]!=1)// 左右边缘黑子旁边第二个位置均不是黑子
                   {
                      if(ChessBoard[x1-1][y1]==0||ChessBoard[x2+1][y2]==0)// 左右边缘黑子旁边第二个位置有一个没有子，就是活三
                      {
                           return(1);
                      }
                    }
                }
            }
        }
        if(n1+n2-1==2)//如果是连着的二
        {
            if(x1!=-1&&x2!=15)//边缘黑子不是位于棋盘边缘
            {
                 if(ChessBoard[x1][y1]==0&&ChessBoard[x2][y2]==0)// 边缘黑子的边缘没有子
                {
                   if(x1==0&&ChessBoard[x2+1][y2]==1&&ChessBoard[x2+2][y2]==0) return(1);// 左边边缘黑子的横坐标是1，那么右边边缘黑子向右第二个位置有黑子，第三个位置没有子，就是活三
                   else if(x2==14&&ChessBoard[x1-1][y1]==1&&ChessBoard[x1-2][y2]==0) return(1);// 右边边缘黑子的横坐标是13，那么左边边缘黑子向左第二个位置有黑子， 第三个位置没有子，就是活三
                   else if(x1>1&&ChessBoard[x1-1][y1]==1&&ChessBoard[x2+1][y2]!=1&&ChessBoard[x1-2][y1]==0&&x2<13&&ChessBoard[x1-1][y1]!=1&&ChessBoard[x2+1][y2]==1&&ChessBoard[x2+2][y2]==0)   return(2);// 满足下排两个的就有两个活三
                   else if(x1>1&&ChessBoard[x1-1][y1]==1&&ChessBoard[x2+1][y2]!=1&&ChessBoard[x1-2][y1]==0) return(1);// 左边缘黑子向左第二个位置是黑子，右边缘黑子向右第二个位置没有子，左边缘第三个位置没有子，就是活三
                   else if(x2<13&&ChessBoard[x1-1][y1]!=1&&ChessBoard[x2+1][y2]==1&&ChessBoard[x2+2][y2]==0) return(1);// 右边缘黑子向右第二个位置是黑子，左边缘黑子向左第二个位置没有子，右边缘第三个位置没有子，就是活三
                 }
            }
        }
        if(n1+n2-1==1)//只有一个子
        {
             if(x1!=-1&&x2!=15)//边缘黑子不是位于棋盘边缘
            {
                 if(ChessBoard[x1][y1]==0&&ChessBoard[x2][y2]==0)//边缘黑子的边缘没有子
                {
                   if(x1==0&&ChessBoard[x2+1][y2]==1&&ChessBoard[x2+2][y2]==1&&ChessBoard[x2+3][y2]==0) return(1);// 黑子横坐标是1，向右第二个位置，第三个位置有黑子，第四个位置没有子，是活三
                   else if(x2==14&&ChessBoard[x1-1][y1]==1&&ChessBoard[x1-2][y1]==1&&ChessBoard[x1-3][y1]==0) return(1);// 黑子横坐标是13，向左第二个位置，第三个位置有黑子，第四个位置没有子，是活三
                    else if(x1>2&&ChessBoard[x1-1][y1]==1&&ChessBoard[x2+1][y2]!=1&&ChessBoard[x1-2][y1]==1&&ChessBoard[x1-3][y1]==0&&x2<12&&ChessBoard[x1-1][y1]!=1&&ChessBoard[x2+1][y2]==1&&ChessBoard[x2+2][y2]==1&&ChessBoard[x2+3][y2]==0) return(2);// 黑子向左第二个位置，第三个位置有黑子，第四个位置没有子，黑子向右第二个位置，第三个位置有黑子，第四个位置没有子，就有2个活三
                   else if(x1>2&&ChessBoard[x1-1][y1]==1&&ChessBoard[x2+1][y2]!=1&&ChessBoard[x1-2][y1]==1&&ChessBoard[x1-3][y1]==0) return(1);// 黑子向左第二个位置，第三个位置有黑子，第四个位置没有子，向右第二个位置不是黑子，就是活三
                   else if(x2<12&&ChessBoard[x1-1][y1]!=1&&ChessBoard[x2+1][y2]==1&&ChessBoard[x2+2][y2]==1&&ChessBoard[x2+3][y2]==0) return(1);// 黑子向右第二个位置，第三个位置有黑子，第四个位置没有子，向左第二个位置不是黑子，就是活三
                }
            }
        }
        return(0);
}
int ishuosan2(int x,int y)//与ishuosan1类似，只是竖直考虑活三问题
{
      int j,k,x1,x2,y1,y2,n1,n2;
        /*竖直判断是否有活三*/
        n1=0;
        n2=0;
        /*垂直向上数*/
        for(j=x,k=y;k>=0;k--)
        {
            if(ChessBoard[j][k]==1)
            {
                   n1++;
                   x1=j;y1=-1;
            }
            else
            {
                x1=j;y1=k;
                break ;
            }
        }
        /*垂直向下数*/
        for(j=x,k=y;k<=14;k++)
        {
            if(ChessBoard[j][k]==1)
             {
                   n2++;
                   x2=j;y2=15;
             }
            else
            {
                 x2=j;y2=k;
                break ;
            }
        }
         if(n1+n2-1==3)
        {
            if(y1!=-1&&y2!=15)
            {
               if(ChessBoard[x1][y1]==0&&ChessBoard[x2][y2]==0)
               {
                 if(y1==0&&ChessBoard[x2][y2+1]==0) return(1);
                 else if(y2==14&&ChessBoard[x1][y1-1]==0) return(1);
                 else if(ChessBoard[x1][y1-1]!=1&&ChessBoard[x2][y2+1]!=1)
                 {
                      if(ChessBoard[x1][y1-1]==0||ChessBoard[x2][y2+1]==0)
                      {
                           return(1);
                      }
                 }
               }
            }
        }
        if(n1+n2-1==2)
        {
            if(y1!=-1&&y2!=15)
            {
                 if(ChessBoard[x1][y1]==0&&ChessBoard[x2][y2]==0)
                {
                   if(y1==0&&ChessBoard[x2][y2+1]==1&&ChessBoard[x2][y2+2]==0) return(1);
                   else if(y2==14&&ChessBoard[x1][y1-1]==1&&ChessBoard[x1][y1-2]==0) return(1);
                   else if(y1>1&&ChessBoard[x1][y1-1]==1&&ChessBoard[x2][y2+1]!=1&&ChessBoard[x1][y1-2]==0&&y2<13&&ChessBoard[x1][y1-1]!=1&&ChessBoard[x2][y2+1]==1&&ChessBoard[x2][y2+2]==0) return(2);
                   else if(y1>1&&ChessBoard[x1][y1-1]==1&&ChessBoard[x2][y2+1]!=1&&ChessBoard[x1][y1-2]==0) return(1);
                   else if(y2<13&&ChessBoard[x1][y1-1]!=1&&ChessBoard[x2][y2+1]==1&&ChessBoard[x2][y2+2]==0) return(1);

                 }
            }
        }
        if(n1+n2-1==1)
        {
             if(x1!=-1&&x2!=15)
            {
                 if(ChessBoard[x1][y1]==0&&ChessBoard[x2][y2]==0)
                {
                   if(y1==0&&ChessBoard[x2][y2+1]==1&&ChessBoard[x2][y2+2]==1&&ChessBoard[x2][y2+3]==0) return(1);
                   else if(y2==14&&ChessBoard[x1][y1-1]==1&&ChessBoard[x1][y1-2]==1&&ChessBoard[x1][y1-3]==0) return(1);
                   else if(y1>2&&ChessBoard[x1][y1-1]==1&&ChessBoard[x2][y2+1]!=1&&ChessBoard[x1][y1-2]==1&&ChessBoard[x1][y1-3]==0&&y2<12&&ChessBoard[x1][y1-1]!=1&&ChessBoard[x2][y2+1]==1&&ChessBoard[x2][y2+2]==1&&ChessBoard[x2][y2+3]==0) return(2);
                   else if(y1>2&&ChessBoard[x1][y1-1]==1&&ChessBoard[x2][y2+1]!=1&&ChessBoard[x1][y1-2]==1&&ChessBoard[x1][y1-3]==0) return(1);
                   else if(y2<12&&ChessBoard[x1][y1-1]!=1&&ChessBoard[x2][y2+1]==1&&ChessBoard[x2][y2+2]==1&&ChessBoard[x2][y2+3]==0) return(1);

                 }
            }
        }
         return(0);
}
int ishuosan3(int x,int y)//与ishuosan1类似，只是从左上方到右下方进行判断是否有活三
{
         int j,k,x1,x2,y1,y2,n1,n2;
        /*从左上方到右下方进行判断是否有活三*/
        n1=0;
        n2=0;
        /*向左上方数*/
        for(j=x,k=y;(j>=0)&&(k>=0);j--,k--)
        {
            if(ChessBoard[j][k]==1)
             {
                    n1++;
                    x1=-1;y1=-1;
             }
            else
            {
                x1=j;y1=k;
                break;
            }
        }
        /*向右下方数*/
       for(j=x,k=y;(j<=14)&&(k<=14);j++,k++)
        {
            if(ChessBoard[j][k]==1)
             {
                 n2++;
                 x2=15;y2=15;
             }
            else
            {   x2=j;y2=k;
                break;
            }
        }
        if(n1+n2-1==3)
        {
            if(x1!=-1&&x2!=15&&y1!=-1&&y2!=15)
            {
               if(ChessBoard[x1][y1]==0&&ChessBoard[x2][y2]==0)
               {
                 if(y1==0&&ChessBoard[x2+1][y2+1]==0) return(1);
                 else if(x1==0&&ChessBoard[x2+1][y2+1]==0) return(1);
                 else if(y2==14&&ChessBoard[x1-1][y1-1]==0) return(1);
                 else if(x2==14&&ChessBoard[x1-1][y1-1]==0) return(1);
                 else if(ChessBoard[x1-1][y1-1]!=1&&ChessBoard[x2+1][y2+1]!=1)
                 {
                      if(ChessBoard[x1-1][y1-1]==0||ChessBoard[x2+1][y2+1]==0)
                      {
                           return(1);
                      }
                 }
               }
            }
        }
        if(n1+n2-1==2)
        {
            if(x1!=-1&&x2!=15&&y1!=-1&&y2!=15)
            {
               if(ChessBoard[x1][y1]==0&&ChessBoard[x2][y2]==0)
               {
                 if(x2<13&&y2<13&&y1==0&&ChessBoard[x2+1][y2+1]==1&&ChessBoard[x2+2][y2+2]==0) return(1);
                 else if(x2<13&&y2<13&&x1==0&&ChessBoard[x2+1][y2+1]==1&&ChessBoard[x2+2][y2+2]==0) return(1);
                 else if(x1>1&&y1>1&&y2==14&&ChessBoard[x1-1][y1-1]==1&&ChessBoard[x1-2][y1-2]==0) return(1);
                 else if(x1>1&&y1>1&&x2==14&&ChessBoard[x1-1][y1-1]==1&&ChessBoard[x1-2][y1-2]==0) return(1);
                 else if(x2<13&&y2<13&&ChessBoard[x1-1][y1-1]!=1&&ChessBoard[x2+1][y2+1]==1&&ChessBoard[x2+2][y2+2]==0&&x1>1&&y1>1&&ChessBoard[x1-1][y1-1]==1&&ChessBoard[x2+1][y2+1]!=1&&ChessBoard[x1-2][y1-2]==0) return (2);
                 else if(x2<13&&y2<13&&ChessBoard[x1-1][y1-1]!=1&&ChessBoard[x2+1][y2+1]==1&&ChessBoard[x2+2][y2+2]==0) return (1);
                 else if(x1>1&&y1>1&&ChessBoard[x1-1][y1-1]==1&&ChessBoard[x2+1][y2+1]!=1&&ChessBoard[x1-2][y1-2]==0) return (1);

               }
            }
        }
        if(n1+n2-1==1)
        {
            if(x1!=-1&&x2!=15&&y1!=-1&&y2!=15)
            {
               if(ChessBoard[x1][y1]==0&&ChessBoard[x2][y2]==0)
               {
                 if(x2<12&&y2<12&&y1==0&&ChessBoard[x2+1][y2+1]==1&&ChessBoard[x2+2][y2+2]==1&&ChessBoard[x2+3][y2+3]==0) return(1);
                 else if(x2<12&&y2<12&&x1==0&&ChessBoard[x2+1][y2+1]==1&&ChessBoard[x2+2][y2+2]==1&&ChessBoard[x2+3][y2+3]==0) return(1);
                 else if(x1>2&&y1>2&&y2==14&&ChessBoard[x1-1][y1-1]==1&&ChessBoard[x1-2][y1-2]==1&&ChessBoard[x1-3][y1-3]==0) return(1);
                 else if(x1>2&&y1>2&&x2==14&&ChessBoard[x1-1][y1-1]==1&&ChessBoard[x1-2][y1-2]==1&&ChessBoard[x1-3][y1-3]==0) return(1);
                 else if(x2<12&&y2<12&&ChessBoard[x1-1][y1-1]!=1&&ChessBoard[x2+1][y2+1]==1&&ChessBoard[x2+2][y2+2]==1&&ChessBoard[x2+3][y2+3]==0&& x1>2&&y1>2&&ChessBoard[x1-1][y1-1]==1&&ChessBoard[x2+1][y2+1]!=1&&ChessBoard[x1-2][y1-2]==1&&ChessBoard[x1-3][y1-3]==0) return (2);
                 else if(x2<12&&y2<12&&ChessBoard[x1-1][y1-1]!=1&&ChessBoard[x2+1][y2+1]==1&&ChessBoard[x2+2][y2+2]==1&&ChessBoard[x2+3][y2+3]==0) return (1);
                 else if(x1>2&&y1>2&&ChessBoard[x1-1][y1-1]==1&&ChessBoard[x2+1][y2+1]!=1&&ChessBoard[x1-2][y1-2]==1&&ChessBoard[x1-3][y1-3]==0) return (1);
               }
            }
        }
        return(0);
}
int ishuosan4(int x,int y)//与ishuosan1类似，只是从右上方到左下方进行判断是否有活三
{
         int j,k,x1,x2,y1,y2,n1,n2;
        /*从右上方到左下方进行判断是否有活三*/
        n1=0;
        n2=0;
        /*向右上方数*/
        for(j=x,k=y;(j<=14)&&(k>=0);j++,k--)
        {
            if(ChessBoard[j][k]==1)
             {
                     n1++;
                     x1=15;y1=-1;
             }
            else
            {
                x1=j;y1=k;
                break;
            }
        }
        /*向左下方数*/
        for(j=x,k=y;(j>=0)&&(k<=14);j--,k++)
        {
            if(ChessBoard[j][k]==1)
            {
                  n2++;
                  x2=-1;y2=15;
            }
            else
            {
                x2=j;y2=k;
                break;
            }
        }
        if(n1+n2-1==3)
        {
            if(x1!=15&&y1!=-1&&x2!=-1&&y2!=15)
            {
              if(ChessBoard[x1][y1]==0&&ChessBoard[x2][y2]==0)
              {
                 if(y1==0&&ChessBoard[x2-1][y2+1]==0) return(1);
                 else if(x1==0&&ChessBoard[x2-1][y2+1]==0) return(1);
                 else if(y2==14&&ChessBoard[x1+1][y1-1]==0) return(1);
                 else if(x2==14&&ChessBoard[x1+1][y1-1]==0) return(1);
                 else if(ChessBoard[x1+1][y1-1]!=1&&ChessBoard[x2-1][y2+1]!=1)
                 {
                      if(ChessBoard[x1+1][y1-1]==0||ChessBoard[x2-1][y2+1]==0)
                      {
                           return(1);
                      }
                 }
              }
            }
        }
        if(n1+n2-1==2)
        {
            if(x1!=15&&y1!=-1&&x2!=-1&&y2!=15)
            {
               if(ChessBoard[x1][y1]==0&&ChessBoard[x2][y2]==0)
               {
                 if(x2>1&&y2<13&&y1==0&&ChessBoard[x2-1][y2+1]==1&&ChessBoard[x2-2][y2+2]==0) return(1);
                 else if(x2>1&&y2<13&&x1==0&&ChessBoard[x2-1][y2+1]==1&&ChessBoard[x2-2][y2+2]==0) return(1);
                 else if(x1<13&&y1>1&&y2==14&&ChessBoard[x1+1][y1-1]==1&&ChessBoard[x1+2][y1-2]==0) return(1);
                 else if(x1<13&&y1>1&&x2==14&&ChessBoard[x1+1][y1-1]==1&&ChessBoard[x1+2][y1-2]==0) return(1);
                else if(x2>1&&y2<13&&ChessBoard[x1+1][y1-1]!=1&&ChessBoard[x2-1][y2+1]==1&&ChessBoard[x2-2][y2+2]==0&&x1<13&&y1>1&&ChessBoard[x1+1][y1-1]==1&&ChessBoard[x2-1][y2+1]!=1&&ChessBoard[x1+2][y1-2]==0) return (2);
                 else if(x2>1&&y2<13&&ChessBoard[x1+1][y1-1]!=1&&ChessBoard[x2-1][y2+1]==1&&ChessBoard[x2-2][y2+2]==0) return (1);
                 else if(x1<13&&y1>1&&ChessBoard[x1+1][y1-1]==1&&ChessBoard[x2-1][y2+1]!=1&&ChessBoard[x1+2][y1-2]==0) return (1);
               }
            }
        }
        if(n1+n2-1==1)
        {
            if(x1!=15&&x2!=-1&&y1!=-1&&y2!=15)
            {
               if(ChessBoard[x1][y1]==0&&ChessBoard[x2][y2]==0)
               {
                 if(x2>2&&y2<12&&y1==0&&ChessBoard[x2-1][y2+1]==1&&ChessBoard[x2-2][y2+2]==1&&ChessBoard[x2-3][y2+3]==0) return(1);
                 else if(x2>2&&y2<12&&x1==14&&ChessBoard[x2-1][y2+1]==1&&ChessBoard[x2-2][y2+2]==1&&ChessBoard[x2-3][y2+3]==0) return(1);
                 else if(x1<12&&y1>2&&y2==14&&ChessBoard[x1+1][y1-1]==1&&ChessBoard[x1+2][y1-2]==1&&ChessBoard[x1+3][y1-3]==0) return(1);
                 else if(x1<12&&y1>2&&x2==0&&ChessBoard[x1+1][y1-1]==1&&ChessBoard[x1+2][y1-2]==1&&ChessBoard[x1+3][y1-3]==0) return(1);
                 else if(x2>2&&y2<12&&ChessBoard[x1+1][y1-1]!=1&&ChessBoard[x2-1][y2+1]==1&&ChessBoard[x2-2][y2+2]==1&&ChessBoard[x2-3][y2+3]==0&&x1<12&&y1>2&&ChessBoard[x1+1][y1-1]==1&&ChessBoard[x2-1][y2+1]!=1&&ChessBoard[x1+2][y1-2]==1&&ChessBoard[x1+3][y1-3]==0) return (2);
                 else if(x2>2&&y2<12&&ChessBoard[x1+1][y1-1]!=1&&ChessBoard[x2-1][y2+1]==1&&ChessBoard[x2-2][y2+2]==1&&ChessBoard[x2-3][y2+3]==0) return (1);
                 else if(x1<12&&y1>2&&ChessBoard[x1+1][y1-1]==1&&ChessBoard[x2-1][y2+1]!=1&&ChessBoard[x1+2][y1-2]==1&&ChessBoard[x1+3][y1-3]==0) return (1);

               }
            }
        }
        return(0);
}
int isfour1(int x,int y)//水平判断四
{
       int j,k,n1,n2;//j,k是循环变量，n1是向左的黑子数，n2是向右的黑子数
       n1=0;
       n2=0;
       /*水平判断是否有冲四活四*/
       int x1,x2,y1,y2;//记录边缘黑子旁边第一个位置的坐标
        /*水平向左数*/
        for(j=x,k=y;j>=0;j--)
        {
            if(ChessBoard[j][k]==1)//如果是黑子
            {
                  n1++;
                  x1=-1;y1=k;
            }
            else//如果不是黑子
            {
                x1=j;y1=k;// 记录此点的坐标
                break;
            }
        }
        /*水平向右数*/
        for(j=x,k=y;j<=14;j++)
        {
            if(ChessBoard[j][k]==1)//如果是黑子
            {
                   n2++;
                   x2=15;y2=k;
            }
            else
            {
                x2=j;y2=k;//记录此点坐标
                break;
            }
        }
        if(n1+n2-1==4)//如果是连着的4
        {
            if(x1!=-1&&x2!=15)//如果边缘黑子不在棋盘边缘
            {
                 if(ChessBoard[x1][y1]==0||ChessBoard[x2][y2]==0) return(1);//左右边缘黑子旁边第一个位置有一个没有子，就是可以成五的四
            }
            else if(x1==-1)
            {
                 if(ChessBoard[x2][y2]==0) return(1);//如果左边缘黑子在棋盘边缘，则右边缘黑子向右第一个位置没有子，就是可以成五的四
            }
            else if(x2==15)
            {
                 if(ChessBoard[x1][y1]==0) return(1);//如果右边缘黑子在棋盘边缘，则左边缘黑子向左第一个位置没有自，就是可以成五的四
            }
        }
        if(n1+n2-1==3)// 如果是连着的3
        {
            if(x1!=-1&&x2!=15)//如果边缘黑子不在棋盘边缘
            {
                 if(x1>1&&ChessBoard[x1][y1]==0&&ChessBoard[x1-1][y1]==1&&x2<13&&ChessBoard[x2][y2]==0&&ChessBoard[x2+1][y2]==1) return(2);//满足下排两个条件，有两个冲四
                 else if(x1>1&&ChessBoard[x1][y1]==0&&ChessBoard[x1-1][y1]==1) return(1);//左边缘黑子向左第一个位置没有子，第二个位置是黑子，是冲四
                 else if(x2<13&&ChessBoard[x2][y2]==0&&ChessBoard[x2+1][y2]==1) return(1);//右边缘黑子向右第一个位置没有子，第二个位置是黑子，是冲四
            }
            else if(x1==-1)//如果左边缘黑子在棋盘边缘
            {
                 if(ChessBoard[x2][y2]==0&&ChessBoard[x2+1][y2]==1) return(1);//右边缘黑子向右第一个子没有子，第二个是黑子，是冲四
            }
            else if(x2==15)//如果右边缘黑子在棋盘边缘
            {
                 if(ChessBoard[x1][y1]==0&&ChessBoard[x1-1][y1]==1) return(1);//左边缘黑子向左第一个没有子，第二个是黑子，是冲四
            }
        }
        if(n1+n2-1==2)//如果是连着的2
        {
            if(x1!=-1&&x2!=15)//边缘黑子不再棋盘边缘
            {
                 if(x1>2&&ChessBoard[x1][y1]==0&&ChessBoard[x1-1][y1]==1&&x2<12&&ChessBoard[x2][y2]==0&&ChessBoard[x2+1][y2]==1&&ChessBoard[x2+2][y2]==1) return(2);//满足下排两个条件的有两个冲四
                 else if(x1>2&&ChessBoard[x1][y1]==0&&ChessBoard[x1-1][y1]==1&&ChessBoard[x1-2][y1]==1) return(1);//左边缘黑子向左第一个没有子，第二个是黑子，第三个是黑子，是冲四
                 else if(x2<12&&ChessBoard[x2][y2]==0&&ChessBoard[x2+1][y2]==1&&ChessBoard[x2+2][y2]==1) return(1);//右边缘黑子向右第一个没有子，第二个是黑子，第三个是黑子，是冲四
            }
            else if(x1==-1)//如果左边缘黑子在棋盘边缘
            {
                 if(ChessBoard[x2][y2]==0&&ChessBoard[x2+1][y2]==1&&ChessBoard[x2+2][y2]==1) return(1);//右边缘黑子向右第一个没有子，第二个，第三个是黑子，是冲四
            }
            else if(x2==15)//如果右边缘黑子在棋盘边缘
            {
                 if(ChessBoard[x1][y1]==0&&ChessBoard[x1-1][y1]==1&&ChessBoard[x1-2][y1]==1) return(1); // 左边缘黑子向左第一个没有子，第二个是黑子，第三个是黑子，是冲四
            }
        }
        if(n1+n2-1==1)//如果只有一个子
        {
            if(x1!=-1&&x2!=15)//边缘黑子不再棋盘边缘
            {
                 if(x1>3&&ChessBoard[x1][y1]==0&&ChessBoard[x1-1][y1]==1&&ChessBoard[x1-2][y1]==1&&ChessBoard[x1-3][y1]==1&&ChessBoard[x1-4][y1]==0&&ChessBoard[x2+1][y2]==1&&ChessBoard[x2+2][y2]==1&&ChessBoard[x2+3][y2]==1) return(2);//满足下排两个条件，有两个冲四
                 else if(x1>3&&ChessBoard[x1][y1]==0&&ChessBoard[x1-1][y1]==1&&ChessBoard[x1-2][y1]==1&&ChessBoard[x1-3][y1]==1) return(1);//左边缘黑子向左第一个没有子，第二个是黑子，第三个是黑子，第四个是黑子，是冲四
                 else if(x2<11&&ChessBoard[x2][y2]==0&&ChessBoard[x2+1][y2]==1&&ChessBoard[x2+2][y2]==1&&ChessBoard[x2+3][y2]==1) return(1);//右边缘黑子向右第一个没有子，第二个，第三个，第四个是黑子，是冲四
            }
            else if(x1==-1)//如果左边缘黑子在棋盘边缘
            {
                 if(ChessBoard[x2][y2]==0&&ChessBoard[x2+1][y2]==1&&ChessBoard[x2+2][y2]==1&&ChessBoard[x2+3][y2]==1) return(1);//右边缘黑子向右第一个没有子，第二个，第三个，第四个是黑子，是冲四
            }
            else if(x2==15)//如果右边缘黑子在棋盘边缘
            {
                 if(ChessBoard[x1][y1]==0&&ChessBoard[x1-1][y1]==1&&ChessBoard[x1-2][y1]==0&&ChessBoard[x1-3][y1]==1) return(1);//左边缘黑子向左第一个没有子，第二个是黑子，第三个是黑子，第四个是黑子，是冲四
            }
        }
        return(0);
}
int isfour2(int x,int y)//类似isfour1，只是竖直判断四
{
       int j,k,x1,x2,y1,y2,n1,n2;
        /*竖直判断是否有冲四活四*/
        n1=0;
        n2=0;
        /*垂直向上数*/
        for(j=x,k=y;k>=0;k--)
        {
            if(ChessBoard[j][k]==1)
            {
                   n1++;
                   x1=j;y1=-1;
            }
            else
            {
                x1=j;y1=k;
                break ;
            }
        }
        /*垂直向下数*/
        for(j=x,k=y;k<=14;k++)
        {
            if(ChessBoard[j][k]==1)
             {
                   n2++;
                   x2=j;y2=15;
             }
            else
            {
                 x2=j;y2=k;
                break ;
            }
        }
        if(n1+n2-1==4)
        {
            if(y1!=-1&&y2!=15)
            {
                 if(ChessBoard[x1][y1]==0||ChessBoard[x2][y2]==0) return(1);
            }
            else if(y1==-1)
            {
                 if(ChessBoard[x2][y2]==0) return(1);
            }
            else if(y2==15)
            {
                 if(ChessBoard[x1][y1]==0) return(1);
            }
        }
        if(n1+n2-1==3)
        {
            if(y1!=-1&&y2!=15)
            {
                 if(y1>1&&ChessBoard[x1][y1]==0&&ChessBoard[x1][y1-1]==1&&y2<13&&ChessBoard[x2][y2]==0&&ChessBoard[x2][y2+1]==1&&ChessBoard[x2][y2+2]==0) return(2);
                  else if(y1>1&&ChessBoard[x1][y1]==0&&ChessBoard[x1][y1-1]==1) return(1);
                 else if(y2<13&&ChessBoard[x2][y2]==0&&ChessBoard[x2][y2+1]==1) return(1);
           }
            else if(y1==-1)
            {
                 if(ChessBoard[x2][y2]==0&&ChessBoard[x2][y2+1]==1&&ChessBoard[x2][y2+2]==0) return(1);
            }
            else if(y2==15)
            {
                 if(ChessBoard[x1][y1]==0&&ChessBoard[x1][y1-1]==1&&ChessBoard[x1][y1-2]==0) return(1);
            }
        }
        if(n1+n2-1==2)
        {
            if(y1!=-1&&y2!=15)
            {
                 if(y1>2&&ChessBoard[x1][y1]==0&&ChessBoard[x1][y1-1]==1&&ChessBoard[x1][y1-2]==1&&y2<12&&ChessBoard[x2][y2]==0&&ChessBoard[x2][y2+1]==1&&ChessBoard[x2][y2+2]==1) return(2);
                 else if(y1>2&&ChessBoard[x1][y1]==0&&ChessBoard[x1][y1-1]==1&&ChessBoard[x1][y1-2]==1) return(1);
                 else if(y2<12&&ChessBoard[x2][y2]==0&&ChessBoard[x2][y2+1]==1&&ChessBoard[x2][y2+2]==1) return(1);
            }
            else if(y1==-1)
            {
                 if(ChessBoard[x2][y2]==0&&ChessBoard[x2][y2+1]==1&&ChessBoard[x2][y2+2]==1) return(1);
            }
            else if(y2==15)
            {
                 if(ChessBoard[x1][y1]==0&&ChessBoard[x1][y1-1]==1&&ChessBoard[x1][y1-2]==1) return(1);
            }
        }
        if(n1+n2-1==1)
        {
            if(y1!=-1&&y2!=15)
            {
                 if(y2<11&&ChessBoard[x2][y2]==0&&ChessBoard[x2][y2+1]==1&&ChessBoard[x2][y2+2]==1&&ChessBoard[x2][y2+3]==1&&y1>3&&ChessBoard[x1][y1]==0&&ChessBoard[x1][y1-1]==1&&ChessBoard[x1][y1-1]==1&&ChessBoard[x1][y1-3]==1) return(2);
                 else if(y1>3&&ChessBoard[x1][y1]==0&&ChessBoard[x1][y1-1]==1&&ChessBoard[x1][y1-2]==1&&ChessBoard[x1][y1-3]==1) return(1);
                 else if(y2<11&&ChessBoard[x2][y2]==0&&ChessBoard[x2][y2+1]==1&&ChessBoard[x2][y2+2]==1&&ChessBoard[x2][y2+3]==1) return(1);
            }
            else if(y1==-1)
            {
                 if(ChessBoard[x2][y2]==0&&ChessBoard[x2][y2+1]==1&&ChessBoard[x2][y2+2]==1&&ChessBoard[x2][y2+3]==1) return(1);
            }
            else if(y2==15)
            {
                 if(ChessBoard[x1][y1]==0&&ChessBoard[x1][y1-1]==1&&ChessBoard[x1][y1-2]==0&&ChessBoard[x1][y1-3]==1) return(1);
            }
        }
        return(0);
}
int isfour3(int x,int y)//类似isfour1，只是从左上方到右下方进行判断是否有冲四活四
{
        int j,k,x1,x2,y1,y2,n1,n2;
        /*从左上方到右下方进行判断是否有冲四活四*/
        n1=0;
        n2=0;
        /*向左上方数*/
        for(j=x,k=y;(j>=0)&&(k>=0);j--,k--)
        {
            if(ChessBoard[j][k]==1)
             {
                    n1++;
                    x1=-1;y1=-1;
             }
            else
            {
                x1=j;y1=k;
                break;
            }
        }
        /*向右下方数*/
       for(j=x,k=y;(j<=14)&&(k<=14);j++,k++)
        {
            if(ChessBoard[j][k]==1)
             {
                 n2++;
                 x2=15;y2=15;
             }
            else
            {   x2=j;y2=k;
                break;
            }
        }
        if(n1+n2-1==4)
        {
            if(x1!=-1&&y1!=-1&&x2!=15&&y2!=15)
            {
                 if(ChessBoard[x1][y1]==0||ChessBoard[x2][y2]==0) return(1);
            }
            else if(y1==-1)
            {
                 if(ChessBoard[x2][y2]==0) return(1);
            }
            else if(y2==15)
            {
                 if(ChessBoard[x1][y1]==0) return(1);
            }
        }
        if(n1+n2-1==3)
        {
            if(x1!=-1&&y1!=-1&&x2!=15&&y2!=15)
            {
                 if(x2<13&&y2<13&&ChessBoard[x2][y2]==0&&ChessBoard[x2+1][y2+1]==1&&x1>1&&y1>1&&ChessBoard[x1][y1]==0&&ChessBoard[x1-1][y1-1]==1) return(2);
                 else if(x1>1&&y1>1&&ChessBoard[x1][y1]==0&&ChessBoard[x1-1][y1-1]==1) return(1);
                 else if(x2<13&&y2<13&&ChessBoard[x2][y2]==0&&ChessBoard[x2+1][y2+1]==1) return(1);
            }
            else if(y1==-1)
            {
                 if(x2<13&&y2<13&&ChessBoard[x2][y2]==0&&ChessBoard[x2+1][y2+1]==1) return(1);
            }
            else if(y2==15)
            {
                 if(x1>1&&x2>1&&ChessBoard[x1][y1]==0&&ChessBoard[x1-1][y1-1]==1) return(1);
            }
        }
        if(n1+n2-1==2)
        {
            if(x1!=-1&&y1!=-1&&x2!=15&&y2!=15)
            {
                 if(x2<12&&y2<12&&ChessBoard[x2][y2]==0&&ChessBoard[x2+1][y2+1]==1&&ChessBoard[x2+2][y2+2]==1&&x1>2&&y1>2&&ChessBoard[x1][y1]==0&&ChessBoard[x1-1][y1-1]==1&&ChessBoard[x1-2][y1-2]==1) return(2);
                 else if(x1>2&&y1>2&&ChessBoard[x1][y1]==0&&ChessBoard[x1-1][y1-1]==1&&ChessBoard[x1-2][y1-2]==1) return(1);
                 else if(x2<12&&y2<12&&ChessBoard[x2][y2]==0&&ChessBoard[x2+1][y2+1]==1&&ChessBoard[x2+2][y2+2]==1) return(1);
            }
            else if(y1==-1)
            {
                 if(x2<12&&y2<12&&ChessBoard[x2][y2]==0&&ChessBoard[x2+1][y2+1]==1&&ChessBoard[x2+2][y2+2]==1) return(1);
            }
            else if(y2==15)
            {
                 if(x1>2&&y1>2&&ChessBoard[x1][y1]==0&&ChessBoard[x1-1][y1-1]==1&&ChessBoard[x1-2][y1-2]==1) return(1);
            }
        }
         if(n1+n2-1==1)
        {
            if(x1!=-1&&y1!=-1&&x2!=15&&y2!=15)
            {
                 if(x2<11&&y2<11&&ChessBoard[x2][y2]==0&&ChessBoard[x2+1][y2+1]==1&&ChessBoard[x2+2][y2+2]==1&&ChessBoard[x2+3][y2+3]==1&&x1>3&&y1>3&&ChessBoard[x1][y1]==0&&ChessBoard[x1-1][y1-1]==1&&ChessBoard[x1-2][y1-2]==1&&ChessBoard[x1-3][y1-3]==1) return(2);
                 else if(x1>3&&y1>3&&ChessBoard[x1][y1]==0&&ChessBoard[x1-1][y1-1]==1&&ChessBoard[x1-2][y1-2]==1&&ChessBoard[x1-3][y1-3]==1) return(1);
                 else if(x2<11&&y2<11&&ChessBoard[x2][y2]==0&&ChessBoard[x2+1][y2+1]==1&&ChessBoard[x2+2][y2+2]==1&&ChessBoard[x2+3][y2+3]==1) return(1);
            }
            else if(y1==-1)
            {
                 if(x2<11&&y2<11&&ChessBoard[x2][y2]==0&&ChessBoard[x2+1][y2+1]==1&&ChessBoard[x2+2][y2+2]==1&&ChessBoard[x2+3][y2+3]==1) return(1);
            }
            else if(y2==15)
            {
                 if(x1>3&&y1>3&&ChessBoard[x1][y1]==0&&ChessBoard[x1-1][y1-1]==1&&ChessBoard[x1-2][y1-2]==1&&ChessBoard[x1-3][y1-3]==1) return(1);
            }
        }
        return(0);
}
int isfour4(int x,int y)//类似isfour1，只是从右上方到左下方进行判断是否有冲四活四
{
      int j,k,x1,x2,y1,y2,n1,n2;
        /*从右上方到左下方进行判断是否有冲四活四*/
        n1=0;
        n2=0;
        /*向右上方数*/
        for(j=x,k=y;(j<=14)&&(k>=0);j++,k--)
        {
            if(ChessBoard[j][k]==1)
             {
                     n1++;
                     x1=15;y1=-1;
             }
            else
            {
                x1=j;y1=k;
                break;
            }
        }
        /*向左下方数*/
        for(j=x,k=y;(j>=0)&&(k<=14);j--,k++)
        {
            if(ChessBoard[j][k]==1)
            {
                  n2++;
                  x2=-1;y2=15;
            }
            else
            {
                x2=j;y2=k;
                break;
            }
        }
         if(n1+n2-1==4)
        {
            if(x1!=15&&y1!=-1&&x2!=-1&&y2!=15)
            {
                 if(ChessBoard[x1][y1]==0||ChessBoard[x2][y2]==0) return(1);
            }
            else if(y1==-1)
            {
                 if(ChessBoard[x2][y2]==0) return(1);
            }
            else if(y2==15)
            {
                 if(ChessBoard[x1][y1]==0) return(1);
            }
        }
        if(n1+n2-1==3)
        {
            if(x1!=15&&y1!=-1&&x2!=-1&&y2!=15)
            {
                 if(x1<13&&y1>1&&ChessBoard[x1][y1]==0&&ChessBoard[x1+1][y1-1]==1&&x2>1&&y2<13&&ChessBoard[x2][y2]==0&&ChessBoard[x2-1][y2+1]==1) return(2);
                 else if(x1<13&&y1>1&&ChessBoard[x1][y1]==0&&ChessBoard[x1+1][y1-1]==1) return(1);
                 else if(x2>1&&y2<13&&ChessBoard[x2][y2]==0&&ChessBoard[x2-1][y2+1]==1) return(1);
            }
            else if(y1==-1)
            {
                 if(x2>1&&y2<13&&ChessBoard[x2][y2]==0&&ChessBoard[x2-1][y2+1]==1) return(1);
            }
            else if(y2==15)
            {
                 if(x1<13&&x2>1&&ChessBoard[x1][y1]==0&&ChessBoard[x1+1][y1-1]==1) return(1);
            }
        }
        if(n1+n2-1==2)
        {
            if(x1!=15&&y1!=-1&&x2!=-1&&y2!=15)
            {
                 if(x1<12&&y1>2&&ChessBoard[x1][y1]==0&&ChessBoard[x1+1][y1-1]==1&&ChessBoard[x1+2][y1-2]==1&&x2>2&&y2<12&&ChessBoard[x2][y2]==0&&ChessBoard[x2-1][y2+1]==1&&ChessBoard[x2-2][y2+2]==1) return(2);
                 else if(x1<12&&y1>2&&ChessBoard[x1][y1]==0&&ChessBoard[x1+1][y1-1]==1&&ChessBoard[x1+2][y1-2]==1) return(1);
                 else if(x2>2&&y2<12&&ChessBoard[x2][y2]==0&&ChessBoard[x2-1][y2+1]==1&&ChessBoard[x2-2][y2+2]==1) return(1);
            }
            else if(y1==-1)
            {
                 if(x2>2&&y2<12&&ChessBoard[x2][y2]==0&&ChessBoard[x2-1][y2+1]==1&&ChessBoard[x2-2][y2+2]==1) return(1);
            }
            else if(y2==15)
            {
                 if(x1<12&&y1>2&&ChessBoard[x1][y1]==0&&ChessBoard[x1+1][y1-1]==1&&ChessBoard[x1+2][y1-2]==1) return(1);
            }
        }
         if(n1+n2-1==1)
        {
            if(x1!=15&&y1!=-1&&x2!=-1&&y2!=15)
            {
                 if(x1<11&&y1>3&&ChessBoard[x1][y1]==0&&ChessBoard[x1+1][y1-1]==1&&ChessBoard[x1+2][y1-2]==1&&ChessBoard[x1+3][y1-3]==1&&x2>3&&y2<11&&ChessBoard[x2][y2]==0&&ChessBoard[x2-1][y2+1]==1&&ChessBoard[x2-2][y2+2]==1&&ChessBoard[x2-3][y2+3]==1) return(2);
                 else if(x1<11&&y1>3&&ChessBoard[x1][y1]==0&&ChessBoard[x1+1][y1-1]==1&&ChessBoard[x1+2][y1-2]==1&&ChessBoard[x1+3][y1-3]==1) return(1);
                 else if(x2>3&&y2<11&&ChessBoard[x2][y2]==0&&ChessBoard[x2-1][y2+1]==1&&ChessBoard[x2-2][y2+2]==1&&ChessBoard[x2-3][y2+3]==1) return(1);
            }
            else if(y1==-1)
            {
                 if(x2>3&&y2<11&&ChessBoard[x2][y2]==0&&ChessBoard[x2-1][y2+1]==1&&ChessBoard[x2-2][y2+2]==1&&ChessBoard[x2-3][y2+3]==1) return(1);
            }
            else if(y2==15)
            {
                 if(x1<11&&x2>3&&ChessBoard[x1][y1]==0&&ChessBoard[x1+1][y1-1]==1&&ChessBoard[x1+2][y1-2]==1&&ChessBoard[x1+3][y1-3]==1) return(1);
            }
        }
        return(0);
}
int isban(int x,int y)
{
    int n1,n2,j,k,x1,x2,y1,y2;//j,k是循环变量，n1是向左的黑子数，n2是向右的黑子数 ，x1，y1是向左的第一个不是黑子点的坐标，x2,y2是向右的第一个不是黑子点的坐标
      /*对水平方向进行判断是否有5个同色的圆*/
        n1=0;
        n2=0;
        /*水平向左数*/
        for(j=x,k=y;j>=0;j--)
        {
            if(ChessBoard[j][k]==1)//如果是黑子
                n1++;
            else//如果不是黑子
                break;
        }
        /*水平向右数*/
        for(j=x,k=y;j<=14;j++)
        {
            if(ChessBoard[j][k]==1)//如果是黑子
            n2++;
            else//如果不是黑子
                break;
        }
        if(n1+n2-1==5)//如果是五连
        {
            return(0);
        }
        /*对垂直方向进行判断是否有5个同色的圆*/
        n1=0;
        n2=0;
        /*垂直向上数*/
        for(j=x,k=y;k>=0;k--)
        {
            if(ChessBoard[j][k]==1)//如果是黑子
                n1++;
            else//如果不是黑子
                break ;
        }
        /*垂直向下数*/
        for(j=x,k=y;k<=14;k++)
        {
            if(ChessBoard[j][k]==1)//如果是黑子
                n2++;
            else//如果不是黑子
                break ;
        }
        if(n1+n2-1==5)//如果是五连
        {
            return(0);
        }
        /*从左上方到右下方进行判断是否有5个同色的圆*/
        n1=0;
        n2=0;
        /*向左上方数*/
        for(j=x,k=y;(j>=0)&&(k>=0);j--,k--)
        {
            if(ChessBoard[j][k]==1)//如果是黑子
                n1++;
            else//如果不是黑子
                break;
        }
        /*向右下方数*/
       for(j=x,k=y;(j<=14)&&(k<=14);j++,k++)
        {
            if(ChessBoard[j][k]==1)//如果是黑子
                n2++;
            else//如果不是黑子
                break;
        }
        if(n1+n2-1==5)//如果是五连
        {
            return(0);
        }
        /*从右上方到左下方进行判断是否有5个同色的圆*/
        n1=0;
        n2=0;
        /*向右上方数*/
        for(j=x,k=y;(j<=14)&&(k>=0);j++,k--)
        {
            if(ChessBoard[j][k]==1)//如果是黑子
                n1++;
            else//如果不是黑子
            {
                break;
            }
        }
        /*向左下方数*/
        for(j=x,k=y;(j>=0)&&(k<=14);j--,k++)
        {
            if(ChessBoard[j][k]==1)//如果是黑子
                n2++;
            else//如果不是黑子
            {
                break;
            }
        }
        if(n1+n2-1==5)//如果是五连
        {
            return(0);
        }
   /*长联禁手 */
        /*对水平方向进行判断是否有5个同色的圆*/
        n1=0;
        n2=0;
        /*水平向左数*/
        for(j=x,k=y;j>=0;j--)
        {
            if(ChessBoard[j][k]==1)//如果是黑子
                n1++;
            else//如果不是黑子
                break;
        }
        /*水平向右数*/
        for(j=x,k=y;j<=14;j++)
        {
            if(ChessBoard[j][k]==1)//如果是黑子
            n2++;
            else//如果不是黑子
                break;
        }
        if(n1+n2-1>5)//如果是长联
        {
            return(1);
        }
        /*对垂直方向进行判断是否有5个同色的圆*/
        n1=0;
        n2=0;
        /*垂直向上数*/
        for(j=x,k=y;k>=0;k--)
        {
            if(ChessBoard[j][k]==1)//如果是黑子
                n1++;
            else//如果不是黑子
                break ;
        }
        /*垂直向下数*/
        for(j=x,k=y;k<=14;k++)
        {
            if(ChessBoard[j][k]==1)//如果是黑子
                n2++;
            else//如果不是黑子
                break ;
        }
        if(n1+n2-1>5)//如果是长联
        {
            return(1);
        }
        /*从左上方到右下方进行判断是否有5个同色的圆*/
        n1=0;
        n2=0;
        /*向左上方数*/
        for(j=x,k=y;(j>=0)&&(k>=0);j--,k--)
        {
            if(ChessBoard[j][k]==1)//如果是黑子
                n1++;
            else//如果不是黑子
                break;
        }
        /*向右下方数*/
       for(j=x,k=y;(j<=14)&&(k<=14);j++,k++)
        {
            if(ChessBoard[j][k]==1)//如果是黑子
                n2++;
            else//如果不是黑子
                break;
        }
        if(n1+n2-1>5)//如果是长联
        {
            return(1);
        }
        /*从右上方到左下方进行判断是否有5个同色的圆*/
        n1=0;
        n2=0;
        /*向右上方数*/
        for(j=x,k=y;(j<=14)&&(k>=0);j++,k--)
        {
            if(ChessBoard[j][k]==1)//如果是黑子
                n1++;
            else//如果不是黑子
            {

                break;
            }
        }
        /*向左下方数*/
        for(j=x,k=y;(j>=0)&&(k<=14);j--,k++)
        {
            if(ChessBoard[j][k]==1)//如果是黑子
                n2++;
            else//如果不是黑子
            {

                break;
            }
        }
        if(n1+n2-1>5)//如果是长联
        {
            return(1);
        }
        /*33禁手 */
        int a,b,c,d;
        a=ishuosan1(x,y);b=ishuosan2(x,y);c=ishuosan3(x,y);d=ishuosan4(x,y);//a,b,c,d分别是水平，竖直，斜着4个方向上的活三个数
        if(a+b+c+d>=2) return(1);//如果有2个以上的活三
        /*44禁手*/
        a=isfour1(x,y); b=isfour2(x,y); c=isfour3(x,y); d=isfour4(x,y);//a,b,c,d分别是水平，竖直，斜着4个方向上的四的个数
        if(a+b+c+d>=2) return(1);//如果有2个以上的四
        return (0);
}

